/*
 * @Description:
 * @Version: 2.0
 * @Author: Mason
 * @Date: 2023-10-14 16:01:43
 * @LastEditors: Mason
 * @LastEditTime: 2023-10-18 22:36:24
 */
package main

import (
	"fmt"

	"gitee.com/cy1113/credits/config"
	"gitee.com/cy1113/credits/dao"
	"gitee.com/cy1113/credits/router"
	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
)

func main() {

	config.InitConfig("/Users/ccyi/Desktop/MyProjects/credits/config/dev.toml")
	dao.InitMongodb(config.Default.Mongo.Addr, config.Default.Mongo.DBName)

	logrus.SetReportCaller(true)

	r := gin.Default()
	router.InitRouter(r)

	// r.GET("/ping", func(c *gin.Context) {
	// 	c.JSON(http.StatusOK, gin.H{
	// 		"message": "pong",
	// 	})
	// })
	addr := fmt.Sprintf("%s:%d", config.Default.App.Host, config.Default.App.Port)
	logrus.Infof("start server %s ...", addr)
	r.Run(addr)
}
